<?php

/**
 * 工具类
 * Class Func_Util
 */
class Func_Util
{
    public static function checkSwoole()
    {
        $tasks[0] = [
            'task_type' => 'caseprocess_check',
            'task_data' => [],
        ];
        Lib_CatchException::setErrorHandler();
        try {
            $ret = Lib_Request_TcpClient::getInstance()->batSend($tasks);
            if (!$ret) {
                AjaxTool::returnJsonData(4007, 'swoole服务异常,请确认swoole服务是否已经启动');
            }
        } catch (ErrorException $e) {
            Func_Log::write('request_server', 'notice', $e->getMessage());
            AjaxTool::returnJsonData(4007, 'swoole服务异常,请确认swoole服务是否已经启动');
        }
    }
}
